﻿using System;
using Gonte.Validation;

namespace Gonte.ObjectModel
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class RangeFieldAttribute
        : FieldAttribute
    {
        public RangeFieldAttribute(Object minValue, Object maxValue)
        {
            minValue_ = minValue;
            maxValue_ = maxValue;
        }

        public override Gonte.Validation.FieldValidator CreateValidator()
        {
            return new FieldRangeValidator(minValue_, maxValue_);
        }

        public Object MinValue
        {
            get { return minValue_; }
            set { minValue_ = value; }
        }

        public Object MaxValue
        {
            get { return maxValue_; }
            set { maxValue_ = value; }
        }

        private Object minValue_;
        private Object maxValue_;
    }
}
